package com.cadre.system.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cadre.common.utils.oldutil.PageUtils;
import com.cadre.common.utils.oldutil.Query;
import com.cadre.system.domain.officer.A01;
import com.cadre.system.domain.officer.A93;
import com.cadre.system.mapper.A93Mapper;
import com.cadre.system.service.A93Service;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
import java.util.Map;

@Service("a93Service")
public class A93ServiceImpl extends ServiceImpl<A93Mapper, A93> implements A93Service {
    @Autowired
    private A93Mapper a93Mapper;

    @Override //
    public List<A93> selectListByPersonid(String personid) {
        LambdaQueryWrapper<A93> lambdaQueryWrapper = new LambdaQueryWrapper();
        lambdaQueryWrapper.eq(A93::getPersonid, personid);
        lambdaQueryWrapper.orderByAsc(A93::getA9301);
        lambdaQueryWrapper.orderByAsc(A93::getA9302);
        return this.baseMapper.selectList(lambdaQueryWrapper);
    }

    @Override // com.tdqy.cadre.modular.profess.service.A93Service
    public PageUtils selectListforPage(Map<String, Object> map) {
        map.put("page", (String) map.get("pageNum"));
        map.put("limit", (String) map.get("pageSize"));
        String personid = (String) map.get("personid");
        if (!(personid == null || personid.length() == 0)) {
            map.put("personid", personid);
        }
        Page<A93> page = new Query(map).getPage();
        return new PageUtils(page.setRecords(this.a93Mapper.selectListforPage(page, map)));
    }

    @Override // com.tdqy.cadre.modular.profess.service.A93Service
    @Transactional(rollbackFor = {Exception.class})
    public int deleteA93ById(String personId) {
        return this.a93Mapper.deleteA93ById(personId);
    }

    @Override // com.tdqy.cadre.modular.profess.service.A93Service
    @Transactional(rollbackFor = {Exception.class})
    public int saveA93ByList(List<A93> a93List, String personId) {
        return this.a93Mapper.saveA93ByList(a93List, personId);
    }

    @Override // com.tdqy.cadre.modular.profess.service.A93Service
    public List<A93> selectByMaps(Map<String, Object> map) {
        return this.a93Mapper.selectByMaps(map);
    }

    @Override // com.tdqy.cadre.modular.profess.service.A93Service
    public List<A01> selectToLeaders(Map<String, Object> map) {
        return this.a93Mapper.selectToLeaders(map);
    }
}
